home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.2r / card_11791.txt < prev    next >
Text File  |  1989-02-26  |  2KB  |  98 lines

  1. -- card: 11791 from stack: in.2r
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3837
  5. -- name: DeleteFile
  6.  
  7.  
  8. -- part 2 (button)
  9. -- low flags: 00
  10. -- high flags: A004
  11. -- rect: left=224 top=241 right=292 bottom=283
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 27056 / 27056
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: Try It
  20. ----- HyperTalk script -----
  21. --
  22. --12/15/87  ‚Ä¢‚Ä¢‚Ä¢Steve Drazga‚Ä¢‚Ä¢‚Ä¢
  23. --
  24. --This script needs XFCNs 'FilenName' and 'DeleteFile'
  25. --It also uses the HyperTalk function 'OsErr'
  26. --
  27. on mouseUp
  28.   if the optionkey is down then pass mouseup
  29.   put "Please select a file to delete"
  30.   put filename() into deletethis
  31.   if deletethis is empty then
  32.     hide message window
  33.     play oops
  34.     exit mouseup
  35.   end if
  36.   hide message window
  37.  
  38.   answer "Are you sure you want to delete this?" with "Cancel" or "OK"
  39.   if it is "Cancel" then
  40.     play oops
  41.     exit mouseup
  42.   end if
  43.  
  44.   put deletefile(deletethis) into returnedthis
  45.  
  46.   if returnedthis = 0 then
  47.     answer "I hope you were sure, 'cause it's gone!"
  48.   else
  49.     if returnedthis < 0 then
  50.       OsErr returnedthis
  51.     else
  52.       play oops
  53.       answer "Whoops, there was an error"
  54.     end if
  55.   end if
  56.  
  57. end mouseUp
  58.  
  59.  
  60.  
  61. -- part contents for background part 5
  62. ----- text -----
  63. DeleteFile
  64.  
  65. -- part contents for background part 10
  66. ----- text -----
  67. 9
  68.  
  69. -- part contents for background part 6
  70. ----- text -----
  71.  
  72. This will delete the specified file from the disk.  Be careful, there's no turning back.
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. Thanks to:
  80. Dewi Williams
  81. 2227 Juniper Court
  82. Boulder CO 80302
  83. (303) 443 9038
  84. Delphi: DEWI
  85.  
  86.  
  87. -- part contents for background part 7
  88. ----- text -----
  89. Syntax:
  90.  
  91. DeleteFile (<"PathName">)
  92.  
  93. Returns either 0 (meaning a successful operation), 1 (meaning a parameter error), or a negative number (representing an operating system error).
  94.  
  95.  
  96. "PathName" is the full pathname to the file you want to delete.  Do not use quotation marks around it.
  97.  
  98. You can use the OsErr* XCMD to interpret operating system errors.